package com.tnf.bc.bground.controller;

import com.tnf.bc.bground.certificate.pojo.SysUser;
import com.tnf.bc.bground.common.utils.resultutil.ApiResponse;
import com.tnf.bc.bground.service.iface.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.annotation.PostConstruct;

/**
 * @description: //登录控制层
 * @author: lzl
 * @create: 2022-11-18 19:57
 **/
@RestController
@RequestMapping(value = "/user")
public class LoginController {


    @Autowired
    private LoginService loginService;

    @PostMapping(path = "/login")
    public ApiResponse login(@RequestBody SysUser user){
        return loginService.login(user);
    }

    @PostMapping(path = "/register")
    public ApiResponse register(@RequestBody SysUser user){
        return loginService.register(user);
    }

    @RequestMapping("/logout")
    public ApiResponse logout(){
        return loginService.logout();
    }

}